//
//  NewMeheadView.m
//  BigJoy
//
//  Created by Rowling on 2017/7/3.
//  Copyright © 2017年 Rowling. All rights reserved.
//

#import "NewMeheadView.h"
#import "PersonalDataVC.h"

@interface NewMeheadView()
//关注
@property (weak, nonatomic) IBOutlet UIButton *careButton;
//粉丝
@property (weak, nonatomic) IBOutlet UIButton *fansButton;
//保存
@property (weak, nonatomic) IBOutlet UIButton *saveButton;
//发布
@property (weak, nonatomic) IBOutlet UIButton *relaseButton;
//社区
@property (weak, nonatomic) IBOutlet UIButton *shequButton;
// 头像
@property (weak, nonatomic) IBOutlet UIImageView *headImageView;
// 昵称
@property (weak, nonatomic) IBOutlet UILabel *nikeNameLable;
//签名
@property (weak, nonatomic) IBOutlet UILabel *signLable;
//地址
@property (weak, nonatomic) IBOutlet UIButton *addressLable;
// 性别
@property (weak, nonatomic) IBOutlet UIImageView *sexImageView;

@end

@implementation NewMeheadView

+(instancetype)fastLogin {
    return FastLogin;
}
- (IBAction)editButtonClick:(id)sender {
    PersonalDataVC * vc = [PersonalDataVC new];
    [[XMSuperHelper XMControllerOfView:self].navigationController pushViewController:vc animated:YES
     ];
}

- (IBAction)buttonClick:(UIButton *)sender {
    if (self.BtnClickBlock) {
        NSInteger index = sender.tag - 100;
        self.BtnClickBlock(index);
    }
}

-(void)setModel:(UserModel *)model {
    _model = model;
    if ([model.sex isEqualToString:@"1"]) {
        self.sexImageView.image = [UIImage imageNamed:@"male1"];
    }else {
        self.sexImageView.image = [UIImage imageNamed:@"male1"];
    }
    self.nikeNameLable.text = model.nickname;
    [self.saveButton setTitle:[NSString stringWithFormat:@"%@",model.preservation_number] forState:UIControlStateNormal];
    [self.relaseButton setTitle:[NSString stringWithFormat:@"%@",model.works_number] forState:UIControlStateNormal];
    [self.fansButton setTitle:[NSString stringWithFormat:@"%@",model.fan_count] forState:UIControlStateNormal];[self.saveButton setTitle:[NSString stringWithFormat:@"%@",model.preservation_number] forState:UIControlStateNormal];
    [self.careButton setTitle:[NSString stringWithFormat:@"%@",model.attention_number] forState:UIControlStateNormal];
    [self.shequButton setTitle:[NSString stringWithFormat:@"%@",model.community_number] forState:UIControlStateNormal];
    [self.headImageView sd_setImageWithURL:[NSURL URLWithString:model.photo]];
    self.signLable.text = model.signature;
    [self.addressLable setTitle:model.area_name forState:UIControlStateNormal];
}

@end
